package com.ucomm.talent.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import com.ucomm.talent.R;

/**
 * Created with IntelliJ IDEA.
 * User: Vita Hao
 * Date: 13-5-25
 * Time: 下午4:26
 * To change this template use File | Settings | File Templates.
 */
public class CustomProgressDialog extends Dialog {

    public CustomProgressDialog(Context context) {
       // super(context);
        super(context, R.style.dialog_theme);
        initView(context);
    }

    private void initView(Context context){
       LinearLayout layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.custom_progress_layout,null);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
        this.setContentView(layout,lp);

      //  this.setCanceledOnTouchOutside(false);
    }

    @Override
    public void show() {

        if (this.isShowing()) {
            return;
        }
        super.show();
    }
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        this.setCancelable(false);
        return true;
        //return super.onKeyDown(keyCode, event);
    }
}
